package fr.cephb.joperon.core.bio;

/** A object on a chromosome with  delegate position and a delegate chromosome */
public class ChromosomePosition
implements Comparable<ChromosomePosition>
{
private Chromosome chromosome;
private int position;

public ChromosomePosition(Chromosome chromosome, int position)
	{
	this.chromosome=chromosome;
	this.position=position;
	}

/** return the position */
public int getPosition()
	{
	return position;
	}
	
/** return the chromosome */
public Chromosome getChromosome()
	{
	return chromosome;
	}

@Override
/** compare on chromosome/position */
public int compareTo(ChromosomePosition o) {
	int i= getChromosome().compareTo(o.getChromosome());
	if(i!=0) return 0;
	return getPosition()-o.getPosition();
	}

@Override
public String toString() {
	return "{chrom:"+getChromosome()+",position:"+getPosition()+"}";
	}
}
